/**
 * 风险评估字典条目规则表管理初始化
 */
var ManageIndexCase = {
	id: "ManageIndexCaseTable",	//表格id
	seItem: null,		//选中的条目
	table: null,
	layerIndex: -1,
	depType:"科室",
};

/**
 * 初始化表格的列
 */
ManageIndexCase.initColumn = function () {
	return [
		{visible: false},
		{title: '单病种名称', field: 'entityDesc', align: 'left', width:120,valign: 'middle'},
		{title: '病案号', field: 'mrNum', align: 'left', width:80,valign: 'middle'},
		{title: '姓名', field: 'name', align: 'left', width:70, valign: 'middle'},
		{title: '性别', field: 'sex', align: 'left', width:40, valign: 'middle'},
        {title: '年龄', field: 'age', align: 'left', width:40, valign: 'middle'},
		{title: '科室', field: 'locDesc', align: 'left', width:100,valign: 'middle'},
        {title: '主治医生', field: 'admDoctorName', align: 'left', width:100,valign: 'middle'},
        {title: '状态', field: 'status', align: 'left', width:60,valign: 'middle',
        	formatter:function(value,row,index){
				var ret="";
				switch (value) {
					case "I":
						ret="待填报"
						break;
					case "Save":
						ret="保存"
						break;
					case "Submit":
						ret="提交"
						break;
					case "Check":
						ret="审核"
						break;
					case "Back":
						ret="退回"
						break;
					case "Up":
						ret="上报"
						break;
					default:
						break;
				}
            	return ret;
        	}
		},
		{title: '提交日期', field: 'entityUpDate', align: 'center', width:100,valign: 'middle'},
		{title: '就诊号', field: 'episodeId', align: 'left', width:80,valign: 'middle'}
	];
};

/**
 * 查询病例
 */
ManageIndexCase.search =function(){
	var queryData = {};
	queryData['episodeId'] = $("#episodeId").val();
	queryData['name'] = $("#name").val();
	ManageIndexCase.table.refresh({query: queryData,pageNumber: 1});
}

$(function () {

	//列名称
	var searchType = $("#searchType").val();
	var defaultColunms = ManageIndexCase.initColumn();
	var table = new BSTable(ManageIndexCase.id, "/api/caseList", defaultColunms);
	table.setPaginationType("server");
	table.setQueryParams({"key":$("#key").val(),"searchType":searchType, "entityId":$("#entityId").val(),  "locId":$("#locId").val(), "startDate":$("#startDateV").val(), "endDate":$("#endDateV").val(),"depart":$("#departV").val()})
	table.setShowColumns(false);
	table.setShowRefresh(false);
	table.setPageSize(15);
	//table.setPageList([15,30,50,100]);
	table.setShowToggle(false);
    table.setShowExport(false);
	/*table.setFixedColumns(true);//是否固定列
	table.setFixedNumber(4);//固定前几列*/
	table.setSubHeight(-27);
	ManageIndexCase.table = table.init();

});
